package com.sykj.bsc.rwl.util;

import java.text.DecimalFormat;
import java.text.Format;

/**
 * 
 * @ClassName:  Code   
 *@Description: 权限code码工具类
 * @author 任文龙
 ** @date:   2018年8月17日 下午2:22:33
 */
public class Code {
	
	public static String getCode(String parentCode,String ChirdCode) {
		if(parentCode.equals(ChirdCode)) {
			ChirdCode+=String.format(".%04d", 1);	
			return ChirdCode;
		}
		int num=Integer.valueOf(ChirdCode.substring(ChirdCode.length()-4));
		num=num+1;
		String temp=""+num;
		if(temp.length()==1) {
			temp="000"+num;
		}
		if(temp.length()==2) {
			temp="00"+num;
		}
		if(temp.length()==3) {
			temp="0"+num;
		}
		ChirdCode=ChirdCode.substring(0,ChirdCode.length()-4)+temp;
		return ChirdCode;
	}
	
	
	
	//测试
	/*public static void main(String[] args) {
		String code=getCode("0","0.0011");
		System.out.println(code);
	}*/
}
